<template>
	<view>
		<examine-nav @rightClick="showOverPopup" title="举报审核专区" @leftClick="navLeftClick"></examine-nav>

		<view v-if="recode.length !== 0">
			<rules :number="examineNum + todayNum"></rules>
			<!-- 动态 -->
			<dynamicItem :ifShowReport="true" :ifShowImg="true"  v-for="(item,index) in recode" :key="index" :dynamicDate="item" :imgs="item.fileName === '' ? [] : item.fileName.split(',')"></dynamicItem>

			<!-- 通过or不通过按钮 -->
			<view class="btn">
				<view class="btn-wrap">
					<errOrSuccessBtn @btnErrClick="btnErrClick"
					errText="该动态存在异常" successText="该动态无异常"
					@btnSuccessClick="btnSuccessClick"></errOrSuccessBtn>
				</view>
			</view>
			
		</view>
		
		<view class="empty" v-else>
			<view>
				<image src="../../static/empty/index-empty.png" mode=""></image>
			</view>
			<view>暂无审核</view>
		</view>
		
		<!-- 弹窗 -->
		<tipsPopup :show="tipsShow" :ifShowCancel="false" @btnSuccessClick="timeoutTipsConfirm">
		
			<view class="popup-text">
				{{tipsPopupText}}
			</view>
		
			<view class="popup-text-bottom" v-if="ifShowFrequency">
				目前剩余次数：
				<text>{{3 - examineInfo.count}}</text>
			</view>
		
			<view class="popup-text-bottom" v-else>
				「不良审核记录」
				<text>已超过三次</text>
				，取消您的审核员资格。
			</view>
		
		</tipsPopup>
		
		<!-- 结束审核弹窗 -->
		<tips-popup :show="isShowOver" :ifShowCancel="true"
		@btnSuccessClick="confirmOver" @btnErrClick="isShowOver = false">
			<view class="">
				<view class="text-center f-large m-b-20">
					本次审核{{examineNum}}条动态是否结束审核？
				</view>
				<view class="f-s text-center m-b-20">
					本次积累元石奖励：
					<text class="bold" style="color: #00B37A;">{{(examineNum * reward).toFixed(1)}}</text>
				</view>
				<view class="f-s text-center m-b-20">
					元石将在本月最后一日统一领取
				</view>
			</view>
		</tips-popup>
		
	</view>
</template>

<script>
	import dynamicItem from './common/dynamic.vue'
	import errOrSuccessBtn from './common/btn.vue'
	import tipsPopup from './common/tipsPopup.vue'
	import complaint from '../community/common/complaint.vue'
	import rules from './common/rules.vue'
	import examineNav from './common/examineNav.vue'
	import {reportList} from '@/api/examine.js'
	import timeoutLogic from '../../common/mixin/threeTimeout.js'
	export default {
		mixins: [timeoutLogic],
		components: {
			dynamicItem,
			errOrSuccessBtn,
			tipsPopup,
			complaint,
			rules,
			examineNav
		},
		data() {
			return {
				isShowBanPopup: false,
				isShowExcellentPopup: false,
				isShowOver: false,
				recode:[],
			}
		},
		onLoad() {
			// this.getData()
		},
		methods: {
			// 不通过点击
			btnErrClick() {
				//举报isPass 通过传0，不通过传1
				this.submitData.isPass = 1
				uni.$u.throttle(this.submitFun, 500)
			},

			// 通过点击
			btnSuccessClick() {
				//举报isPass 通过传0，不通过传1
				this.submitData.isPass = 0
				uni.$u.throttle(this.submitFun, 500)
			},
			async getData() {
				uni.showLoading({
					title:'',
					mask:true
				})
				try{
					const res = await reportList()
					this.recode = res.data
					this.submitData.type = 'appeal'
					this.submitData.id = res.data.length !== 0 ? res.data[0].appealId : 0
					uni.hideLoading()
					if(!res.data.length){
						uni.showToast({
							title:'暂无数据，请结束审核',
							icon:'none'
						})
					}
					
				}catch(e){
					uni.hideLoading()
					uni.showToast({
						title: e.data || e.message,
						icon: 'none'
					})
				}
			},
			failHide(){
				this.failShow = !this.failShow
			},
			showOverPopup() {
				this.isShowOver = true
			},
		}
	}
</script>

<style lang="scss">
	.empty{
		margin: 0 auto;
		margin-top: 200rpx;
		image{
			width: 418rpx;
			height: 308rpx;
		}
		view{
			margin-top: 10rpx;
			text-align: center;
			color: rgba(146, 146, 146, 1);
			font-size: 28rpx
		}
	}

	.btn {
		height: 142rpx;
		.btn-wrap{
			padding: 30rpx 40rpx;
			position: fixed;
			bottom: 0;
			left: 0;
			width: 100%;
			box-sizing: border-box;
			background-color: #ffffff;
		}
	}

	.bottom {
		padding-bottom: 52rpx;

		.bottom-title {
			text-align: center;
			margin-bottom: 48rpx;
			color: RGBA(157, 157, 157, 1);
		}

		.bottom-main {
			justify-content: space-around;

			.bottom-main-item {
				color: #000000;

				image {
					width: 120rpx;
					height: 120rpx;
					margin-bottom: 20rpx;
				}

				view {
					text-align: center;
				}
			}

		}

	}
	
	.popup-text {
		color: rgba(0, 0, 0, 1);
		font-size: 26rpx;
		text-align: center;
		line-height: 50rpx;
	}

	.popup-text-bottom {
		color: rgba(0, 0, 0, 1);
		font-size: 26rpx;
		text-align: center;
		margin: 40rpx 0;

		text {
			color: rgba(235, 91, 51, 1);
		}
	}
</style>
